<?php
class Base_Model extends CI_Model {
	
// 	public $id;
	
	public function __construct() {
		parent::__construct();
		$this->load->database();
	}
	
	protected function get_paged_data($query, $page, $count) {
		$result = $this->db->query($query)->result_array();
		$total = $this->db->query('SELECT FOUND_ROWS() AS t')->row_array();
		
		return array(
				'data' => $result,
				'page' => $page,
				'pages' => ceil(((int) $total['t']) / $count),
				'count' => $count,
				'total' => (int) $total['t']);
	}
	
// 	protected static function get_db() {
// 		$CI = &get_instance();
// 		return $CI->db;
// 	}
}